import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { CommandVO, CommandForm, CommandQuery } from '@/api/zntx-app/command/types';

/**
 * 查询指令记录列表
 * @param query
 * @returns {*}
 */

export const listCommand = (query?: CommandQuery): AxiosPromise<CommandVO[]> => {
  return request({
    url: '/zntx-app/command/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询指令记录详细
 * @param id
 */
export const getCommand = (id: string | number): AxiosPromise<CommandVO> => {
  return request({
    url: '/zntx-app/command/' + id,
    method: 'get'
  });
};

/**
 * 新增指令记录
 * @param data
 */
export const addCommand = (data: CommandForm) => {
  return request({
    url: '/zntx-app/command',
    method: 'post',
    data: data
  });
};

/**
 * 修改指令记录
 * @param data
 */
export const updateCommand = (data: CommandForm) => {
  return request({
    url: '/zntx-app/command',
    method: 'put',
    data: data
  });
};

/**
 * 删除指令记录
 * @param id
 */
export const delCommand = (id: string | number | Array<string | number>) => {
  return request({
    url: '/zntx-app/command/' + id,
    method: 'delete'
  });
};
